home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- // FILENAME: BBCUI.m
- // SUMMARY: User Interface for a Billiard-Ball Computation Annotation
- // SUPERCLASS: Object
- // INTERFACE: BBCUI
- // PROTOCOLS: <Inspectable>
- // AUTHOR: Rohit Khare
- // COPYRIGHT: (c) 1994 California Institure of Technology, eText Project
- ///////////////////////////////////////////////////////////////////////////////
- // DESCRIPTION
- // Implementation of a shared inspector for BBCs
- // Separated out controller from old BilliardView code.
- ///////////////////////////////////////////////////////////////////////////////
- // HISTORY
- // 05/29/94: Created.
- ///////////////////////////////////////////////////////////////////////////////
-
- #import "BBC.h"
- #define CONT "Controls"
-
- @implementation BBCUI
- // id fileWell;
- // id nameField;
- // id accelSwitch;
- // id editSwitch;
- // id pathSwitch;
- // id fwdButton;
- // id backButton;
- // id hresField;
- // id vresField;
- // id bbcPanel;
- // id bbcView;
- // id theBBC;
-
- + new
- {
- static BBCUI *bbcui = nil;
-
- if (!bbcui) {
- bbcui = [[BBCUI alloc] init];
- }
- return bbcui;
- }
- - init
- {
- char buf[MAXPATHLEN];
- NXBundle *bundle;
-
- [super init];
- bundle = [NXBundle bundleForClass:[BBCUI class]];
- if ( [bundle getPath:buf forResource:"BBCUI" ofType:"nib"] ) {
- [NXApp loadNibFile:buf owner:self withNames:NO];
- } else {
- NXLogError("NIB not found: BBCUI");
- }
- bbcView = [bbcPanel contentView];
- [fwdButton setPeriodicDelay:0 andInterval:0.2];
- [backButton setPeriodicDelay:0 andInterval:0.2];
- return self;
- }
- - free {return self;}
- - (const NXAtom *) types:sender
- {
- static NXAtom types[2] = {NULL, NULL};
-
- if (!types[0]) {
- types[0] = NXUniqueString(CONT);
- }
- return types;
- }
-
- - (char *) inspectorTitle
- {
- return (char *) NXUniqueString("Billiard-Ball Computation");
- }
-
- - resignInspector: (View *) oldInspector ofType: (char *) type :sender
- {
- return self;
- }
-
- - activateInspector: (View *) newInspector ofType: (char *) type :sender
- {
- return self;
- }
-
- - inspectorForType:(char *) type :sender
- {
- if(!strcmp(type,CONT))
- return bbcView;
- else NXLogError("Massive Inspector Failure: Asked BBCUI for: %s", type);
- return bbcView;
- }
-
- - setName:sender {[theBBC setName:NXUniqueString([sender stringValue])]; return self;}
- - setShowPath:sender {[theBBC setShowPath:[pathSwitch state]]; return self;}
- - setAccelerated:sender {[theBBC setAccelerated:![accelSwitch state]]; return self;}
- - setEditable:sender {[theBBC setEditable:[editSwitch state]]; return self;}
- - clickFwd:sender{[theBBC stepForward]; return self;}
- - clickBack:sender{[theBBC stepBackward]; return self;}
- - setRes:sender{[theBBC setRes:[hresField intValue] :[vresField intValue]]; return self;}
- - setBBC:newBBC
- {
- theBBC = newBBC;
- return [self load];
- }
- - bbc {return theBBC;}
- - load
- {
- [nameField setStringValue:[theBBC name]];
- [accelSwitch setState:![theBBC isAccelerated]];
- [pathSwitch setState:[theBBC doesShowPath]];
- [editSwitch setState:[theBBC isEditable]];
- [hresField setIntValue:[theBBC hres]];
- [vresField setIntValue:[theBBC vres]];
- return self;
- }
- @end